package com.dy.design_pattern_study.chain_of_responsibility_pattern.dome3.impl;


import com.dy.design_pattern_study.chain_of_responsibility_pattern.dome3.Manager;
import com.dy.design_pattern_study.chain_of_responsibility_pattern.dome3.Request;

/**
 * @CreateBy zhangdingyi
 * @Date 2023-04-22
 * @Content 总经理类
 */
public class GeneralManager extends Manager {
    public GeneralManager(String name) {
        super(name);
    }

    @Override
    public void resultApplications(Request request) {
        if (request.getRequestType().equals("请假")) {
            //总经理可以批准任意天数的假期
            System.out.println(showBaseMessage(request) + ",被批准！");
        } else if (request.getRequestType().equals("加薪") && request.getNumber() <= 500) {
            //加薪 500以内
            System.out.println(showBaseMessage(request) + ",被批准！");
        } else if (request.getRequestType().equals("加薪") && request.getNumber() > 500) {
            //超过 500 不行
            System.out.println(showBaseMessage(request) + ",再说吧！");
        } else {
            //如果不在权限范围内，需要到上一级申请
            if (superior != null) {
                superior.resultApplications(request);
            }
        }
    }
}
